package com.mtsmda.bookjava7.chapter11.generics.myGeneric;

import java.util.Map;

public class TestGenericClass<K, V, G> {
	private K[] kArray;
	private V vObject;
	private Map<Integer, G> map;

	public TestGenericClass() {

	}

	public K[] getkArray() {
		return kArray;
	}

	public void setkArray(K[] kArray) {
		this.kArray = kArray;
	}

	public V getvObject() {
		return vObject;
	}

	public void setvObject(V vObject) {
		this.vObject = vObject;
	}

	public Map<Integer, G> getMap() {
		return map;
	}

	public void setMap(Map<Integer, G> map) {
		this.map = map;
	}
	
	public K getArrayValueByIndex(int index) throws Exception{
		if(index > kArray.length - 1 || index < 0){
			throw new Exception("Not found index!");
		}
		return kArray[index];
	}
	
	public G getValueFromMap(Integer key) throws Exception{
		if(key == null || this.map.get(key) == null){
			throw new Exception("Not found value to this key!");
		}
		return this.map.get(key);
	}

}